package com.taokatao.cardmee.db.model;

import android.text.TextUtils;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Generated;

@Entity
public class Card extends DBModel {
    @Id private Long id;

    /**
     * 会员卡id
     */
    @Property(nameInDb = "M_CARD_ID") private Long mCardId;

    /**
     * 会员卡号
     */
    @Property(nameInDb = "NO") private String mCardNo;

    /**
     * 会员卡别名
     */
    @Property(nameInDb = "ALIAS_NAME") private String mCardAliasName;
    /**
     * 会员卡等级，1：白银会员，2：黄金会员......
     */
    @Property(nameInDb = "GRADE") private Integer mCardGrade;
    /**
     * 会员卡类别
     */
    @Property(nameInDb = "TYPE") private String mCardType;
    /**
     * 会员卡图标
     */
    @Property(nameInDb = "ICON") private String mCardIcon;
    /**
     * 使用次数
     */
    @Property(nameInDb = "USE_NUM") private Integer useNum;
    /**
     * 使用规则
     */
    @Property(nameInDb = "USE_RULE") private String useRule;
    /**
     * 0#收藏的;1#属于我的;2#通兑卡(消费卡)
     */
    @Property(nameInDb = "IS_MY_CARD") private String isMyCard;
    public static final String STATUS_MY_CARD = "1";
    public static final String STATUS_FAVORITE_CARD = "0";
    public static final String STATUS_XIAOFEI = "2";
    /**
     * 商家id
     */
    @Property(nameInDb = "BUSINESS_ID") private Long businessId;
    /**
     * 商家名称
     */
    @Property(nameInDb = "BUSINESS_NAME") private String businessName;
    /**
     * 会员卡正面图片
     */
    @Property(nameInDb = "POSITIVE_ICON") private String positiveIcon;
    /**
     * 会员卡背面图片
     */
    @Property(nameInDb = "BACK_ICON") private String backIcon;
    /**
     * 备注
     */
    @Property(nameInDb = "REMARK") private String remark;
    /**
     * 分享者昵称
     */
    @Property(nameInDb = "USERNAME") private String userName;
    /**
     * 收藏ID
     */
    @Property(nameInDb = "COLLECT_ID") private String collectId;
    /**
     * 分享者头像
     */
    @Property(nameInDb = "HEAD_IMG_URL") private String headImgUrl;
    /**
     * 其他商家别名(只对其他商家有效)
     */
    @Property(nameInDb = "ANOTHER_BUSINESS") private String anotherBusiness;
    /**
     * 其他商家图片(只对其他商家有效)
     */
    @Property(nameInDb = "BU_PIC") private String buPic;
    /**
     * 持卡人姓名
     */
    @Property(nameInDb = "CARD_USER") private String cardUser;
    /**
     * 持卡人手机号码
     */
    @Property(nameInDb = "CARD_TEL") private String cardTel;
    /**
     * 商家码是否有码
     */
    @Property(nameInDb = "BARCODE_STATUS") private String barcodeStatus;
    /**
     * 商家码类型
     */
    @Property(nameInDb = "BARCODE_FORMAT") private String barcodeFormat;
    /**
     * 点击次数热度(app本地)
     */
    @Property(nameInDb = "APP_SCAN_TIME") private Integer appScanTime;

    /**
     * 主题背景色
     */
    @Property(nameInDb = "PRIMARY_COLOR") private String backColor;

    /**
     * 卡等级(例如爱奇艺金卡会员)
     */
    @Property(nameInDb = "GRADE_NAME") private String gradeName;

    /**
     * 分享类型 (值为9时，卡不能够分享)
     */
    @Property(nameInDb = "SHARE_TYPE") private Integer shareType;
    public static final int SHARE_TYPE_DISABLE = 9;

    @Transient private Integer sysSort = 0;

    /**
     * 商家分店的id
     */
    @Property(nameInDb = "S_ID") private Long sid;

    /**
     * 商家分店名称
     */
    @Property(nameInDb = "S_NAME") private String sname;

    @Override
    public boolean equals(Object o) {
        if (o != null && o instanceof Card) {
            Card other = (Card) o;
            if (mCardId != null && other.mCardId != null &&
                    mCardId.longValue() == other.mCardId.longValue()
                    && isMyCard != null
                    && isMyCard.equals(other.isMyCard)) {
                return true;
            }
        }
        return false;
    }

    @Override
    public String toString() {
        return "Card{" +
                "id=" + id +
                ", mCardId=" + mCardId +
                ", mCardNo='" + mCardNo + '\'' +
                ", mCardAliasName='" + mCardAliasName + '\'' +
                ", mCardGrade=" + mCardGrade +
                ", mCardType='" + mCardType + '\'' +
                ", mCardIcon='" + mCardIcon + '\'' +
                ", useNum=" + useNum +
                ", useRule='" + useRule + '\'' +
                ", isMyCard='" + isMyCard + '\'' +
                ", businessId=" + businessId +
                ", businessName='" + businessName + '\'' +
                ", positiveIcon='" + positiveIcon + '\'' +
                ", backIcon='" + backIcon + '\'' +
                ", remark='" + remark + '\'' +
                ", userName='" + userName + '\'' +
                ", collectId='" + collectId + '\'' +
                ", headImgUrl='" + headImgUrl + '\'' +
                ", anotherBusiness='" + anotherBusiness + '\'' +
                ", buPic='" + buPic + '\'' +
                ", cardUser='" + cardUser + '\'' +
                ", cardTel='" + cardTel + '\'' +
                ", barcodeStatus='" + barcodeStatus + '\'' +
                ", barcodeFormat='" + barcodeFormat + '\'' +
                ", appScanTime=" + appScanTime +
                ", backColor='" + backColor + '\'' +
                ", gradeName='" + gradeName + '\'' +
                ", shareType=" + shareType +
                ", sysSort=" + sysSort +
                ", sid=" + sid +
                ", sname='" + sname + '\'' +
                '}';
    }

    /**
     * 复制排序字段以外的属性值
     */
    public void refreshProperties(Card newProperties) {
        this.mCardId = newProperties.mCardId;
        this.mCardNo = newProperties.mCardNo;
        this.mCardAliasName = newProperties.mCardAliasName;
        this.mCardGrade = newProperties.mCardGrade;
        this.mCardType = newProperties.mCardType;
        this.mCardIcon = newProperties.mCardIcon;
        this.useNum = newProperties.useNum;
        this.useRule = newProperties.useRule;
        this.isMyCard = newProperties.isMyCard;
        this.businessId = newProperties.businessId;
        this.businessName = newProperties.businessName;
        this.positiveIcon = newProperties.positiveIcon;
        this.backIcon = newProperties.backIcon;
        this.remark = newProperties.remark;
        this.userName = newProperties.userName;
        this.collectId = newProperties.collectId;
        this.headImgUrl = newProperties.headImgUrl;
        this.anotherBusiness = newProperties.anotherBusiness;
        this.buPic = newProperties.buPic;
        this.cardUser = newProperties.cardUser;
        this.cardTel = newProperties.cardTel;
        this.barcodeStatus = newProperties.barcodeStatus;
        this.barcodeFormat = newProperties.barcodeFormat;
        // this.appScanTime
        this.backColor = newProperties.backColor;
        this.gradeName = newProperties.gradeName;
        this.shareType = newProperties.shareType;
        this.sid = newProperties.sid;
        this.sname = newProperties.sname;
    }

    public Integer getSysSort() {
        return this.sysSort;
    }

    public void setSysSort(Integer sysSort) {
        this.sysSort = sysSort;
    }

    @Generated(hash = 1410226202)
    public Card(Long id, Long mCardId, String mCardNo, String mCardAliasName,
            Integer mCardGrade, String mCardType, String mCardIcon, Integer useNum,
            String useRule, String isMyCard, Long businessId, String businessName,
            String positiveIcon, String backIcon, String remark, String userName,
            String collectId, String headImgUrl, String anotherBusiness,
            String buPic, String cardUser, String cardTel, String barcodeStatus,
            String barcodeFormat, Integer appScanTime, String backColor,
            String gradeName, Integer shareType, Long sid, String sname) {
        this.id = id;
        this.mCardId = mCardId;
        this.mCardNo = mCardNo;
        this.mCardAliasName = mCardAliasName;
        this.mCardGrade = mCardGrade;
        this.mCardType = mCardType;
        this.mCardIcon = mCardIcon;
        this.useNum = useNum;
        this.useRule = useRule;
        this.isMyCard = isMyCard;
        this.businessId = businessId;
        this.businessName = businessName;
        this.positiveIcon = positiveIcon;
        this.backIcon = backIcon;
        this.remark = remark;
        this.userName = userName;
        this.collectId = collectId;
        this.headImgUrl = headImgUrl;
        this.anotherBusiness = anotherBusiness;
        this.buPic = buPic;
        this.cardUser = cardUser;
        this.cardTel = cardTel;
        this.barcodeStatus = barcodeStatus;
        this.barcodeFormat = barcodeFormat;
        this.appScanTime = appScanTime;
        this.backColor = backColor;
        this.gradeName = gradeName;
        this.shareType = shareType;
        this.sid = sid;
        this.sname = sname;
    }

    @Generated(hash = 52700939)
    public Card() {
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMCardId() {
        return this.mCardId;
    }

    public void setMCardId(Long mCardId) {
        this.mCardId = mCardId;
    }

    public String getMCardNo() {
        return this.mCardNo;
    }

    public void setMCardNo(String mCardNo) {
        this.mCardNo = mCardNo;
    }

    public String getMCardAliasName() {
        return this.mCardAliasName;
    }

    public void setMCardAliasName(String mCardAliasName) {
        this.mCardAliasName = mCardAliasName;
    }

    public Integer getMCardGrade() {
        return this.mCardGrade;
    }

    public void setMCardGrade(Integer mCardGrade) {
        this.mCardGrade = mCardGrade;
    }

    public String getMCardType() {
        return this.mCardType;
    }

    public void setMCardType(String mCardType) {
        this.mCardType = mCardType;
    }

    public String getMCardIcon() {
        return this.mCardIcon;
    }

    public void setMCardIcon(String mCardIcon) {
        this.mCardIcon = mCardIcon;
    }

    public Integer getUseNum() {
        return this.useNum;
    }

    public void setUseNum(Integer useNum) {
        this.useNum = useNum;
    }

    public String getUseRule() {
        return this.useRule;
    }

    public void setUseRule(String useRule) {
        this.useRule = useRule;
    }

    public String getIsMyCard() {
        return this.isMyCard;
    }

    public void setIsMyCard(String isMyCard) {
        this.isMyCard = isMyCard;
    }

    public Long getBusinessId() {
        return this.businessId;
    }

    public void setBusinessId(Long businessId) {
        this.businessId = businessId;
    }

    public String getBusinessName() {
        return this.businessName;
    }

    public void setBusinessName(String businessName) {
        this.businessName = businessName;
    }

    public String getPositiveIcon() {
        return this.positiveIcon;
    }

    public void setPositiveIcon(String positiveIcon) {
        this.positiveIcon = positiveIcon;
    }

    public String getBackIcon() {
        return this.backIcon;
    }

    public void setBackIcon(String backIcon) {
        this.backIcon = backIcon;
    }

    public String getRemark() {
        return this.remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getUserName() {
        return this.userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getCollectId() {
        return this.collectId;
    }

    public void setCollectId(String collectId) {
        this.collectId = collectId;
    }

    public String getHeadImgUrl() {
        return this.headImgUrl;
    }

    public void setHeadImgUrl(String headImgUrl) {
        this.headImgUrl = headImgUrl;
    }

    public String getAnotherBusiness() {
        return this.anotherBusiness;
    }

    public void setAnotherBusiness(String anotherBusiness) {
        this.anotherBusiness = anotherBusiness;
    }

    public String getBuPic() {
        return this.buPic;
    }

    public void setBuPic(String buPic) {
        this.buPic = buPic;
    }

    public String getCardUser() {
        return this.cardUser;
    }

    public void setCardUser(String cardUser) {
        this.cardUser = cardUser;
    }

    public String getCardTel() {
        return this.cardTel;
    }

    public void setCardTel(String cardTel) {
        this.cardTel = cardTel;
    }

    public String getBarcodeStatus() {
        return this.barcodeStatus;
    }

    public void setBarcodeStatus(String barcodeStatus) {
        this.barcodeStatus = barcodeStatus;
    }

    public String getBarcodeFormat() {
        return this.barcodeFormat;
    }

    public void setBarcodeFormat(String barcodeFormat) {
        this.barcodeFormat = barcodeFormat;
    }

    public Integer getAppScanTime() {
        return this.appScanTime;
    }

    public void setAppScanTime(Integer appScanTime) {
        this.appScanTime = appScanTime;
    }

    public String getBackColor() {
        return this.backColor;
    }

    public void setBackColor(String backColor) {
        this.backColor = backColor;
    }

    public String getGradeName() {
        return this.gradeName;
    }

    public void setGradeName(String gradeName) {
        this.gradeName = gradeName;
    }

    public Integer getShareType() {
        return this.shareType;
    }

    public void setShareType(Integer shareType) {
        this.shareType = shareType;
    }

    public Long getSid() {
        return this.sid;
    }

    public void setSid(Long sid) {
        this.sid = sid;
    }

    public String getSname() {
        return this.sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    

}
